import { IsNotEmpty, IsString, IsNumber, IsOptional } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateMenuDto {
  @ApiProperty({ description: '菜单路径', example: '/dashboard' })
  @IsNotEmpty()
  @IsString()
  path: string;

  @ApiProperty({ description: '菜单名称', example: 'Dashboard' })
  @IsNotEmpty()
  @IsString()
  name: string;

  @ApiProperty({
    description: '重定向路径',
    example: '/dashboard/analysis',
    required: false,
  })
  @IsOptional()
  @IsString()
  redirect?: string;

  @ApiProperty({ description: '菜单元信息', example: '{"title": "Dashboard"}' })
  @IsNotEmpty()
  @IsString()
  meta: string;

  @ApiProperty({ description: '父菜单 ID', example: 1, required: false })
  @IsOptional()
  @IsNumber()
  parentId?: number;

  @ApiProperty({ description: '菜单状态，1: 可用，0: 不可用', example: 1 })
  @IsNotEmpty()
  @IsNumber()
  active: number;
}
